home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / share / python / runtime.d / pycentral.rtremove < prev    next >
Text File  |  2009-10-11  |  1KB  |  44 lines

  1. #! /bin/sh -e
  2.  
  3. cmd="$1"
  4. runtime="$2"
  5.  
  6. if which python >/dev/null 2>&1 && which pycentral >/dev/null 2>&1; then
  7.     pycentral rtremove $runtime
  8. else
  9.     flist=$(tempfile)
  10.     for pcdir in /usr/share/pycentral/*; do
  11.     pkg=$(basename $pcdir)
  12.     find /usr/share/pycentral/$pkg -depth -mindepth 2 \
  13.       \( -name '*.py' -printf 'p %P\n' -o -printf '%y %P\n' \) \
  14.       > $flist 2>&1 || true
  15.     if [ -s $flist ]; then
  16.         d=/usr/lib/$runtime
  17.         while read t n; do
  18.         case "$t" in
  19.             p) rm -f $d/$n $d/${n}[co];;
  20.             d) rmdir --ignore-fail-on-non-empty $d/$n 2>/dev/null;;
  21.             *) rm -f $d/$n
  22.         esac
  23.         done < $flist
  24.     fi
  25.     rm -f $flist
  26.     done
  27.  
  28.     find /usr/share/pyshared -depth -mindepth 1 \
  29.     \( -name '*.py' -printf 'p %P\n' -o -printf '%y %P\n' \) \
  30.     > $flist 2>&1 || true
  31.     if [ -s $flist ]; then
  32.     for d in /usr/lib/$runtime/????-packages; do
  33.         while read t n; do
  34.         case "$t" in
  35.             p) rm -f $d/$n $d/${n}[co];;
  36.             d) rmdir --ignore-fail-on-non-empty $d/$n 2>/dev/null;;
  37.             *) rm -f $d/$n
  38.         esac
  39.         done < $flist
  40.     done
  41.     fi
  42.     rm -f $flist
  43. fi
  44.